package com.igeekhome.ccs.controller;

import com.igeekhome.ccs.biz.IDataView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("workCount")
public class WorkCountController {
    @Autowired
    IDataView iDataView;
    @RequestMapping("allmessage")
    public @ResponseBody
    int allmessage(int groupId,int customerId,String startTime,String endTime){
        return iDataView.allmessage(groupId,customerId,startTime,endTime);
    }
    @RequestMapping("allsession")
    public @ResponseBody
    int allsession(int groupId,int customerId,String startTime,String endTime){
        return iDataView.allsession(groupId,customerId,startTime,endTime);
    }
    /**
     * 单会话平均消息数
     */
    @RequestMapping("avgmessage")
    public @ResponseBody
   int avgmessage(int groupId,int customerId,String startTime,String endTime){
        List<Integer> list=iDataView.getallsessionid(groupId,customerId,startTime,endTime);
        int b=iDataView.allmessage(groupId,customerId,startTime,endTime);
            System.out.println(b);
            int a=b/list.size();
        return a;
    }
    /**
     *总会话时长
     */
    /**
     * 平均会话时长
     */
}
